#ifndef POINTCLOUD_H
#define POINTCLOUD_H

#include "typedefs.h"
#include <iostream>
#include <string.h>
//#include "renderState.h"
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/io/pcd_io.h>

namespace pc
{
	//Forward declarations
	class RenderState;

	class PointCloud{
				friend class PointCloudDist;

	public:

		PointCloud()
			: _cloud ( new pcl::PointCloud<pcl::PointXYZRGB> ())
		{
				EQINFO<<"PointCloudCreated!"<<std::endl;

		}

		PointCloud(std::string fileName){

			sensor_msgs::PointCloud2 cloud_blob;
			pcl::io::loadPCDFile ("test_pcd.pcd", cloud_blob);
			pcl::fromROSMsg (cloud_blob, *_cloud);
						EQINFO<<"PointCloudCreated!"<<std::endl;
		}

		~PointCloud()
		{

			//std::cout<<"killing pc"<<std::endl;
			//delete _cloud;
			_cloud = 0;
						//std::cout<<"killed pc"<<std::endl;
		}

		//pcl::PointCloud<pcl::PointXYZRGB>::Ptr getPointCloud(){
		//	return _cloud;
		//}

		//void setPointCloud(pcl::PointCloud<pcl::PointXYZRGB>::Ptr &c){
		//	_cloud=c;
		//}
		
		
		pcl::PointCloud<pcl::PointXYZRGB> *_cloud;
		
		
		void draw(RenderState& state)const;
		bool PointCloud::loadFromFile(std::string fileName);
	private:





	};
}


#endif